<?php


namespace console\controllers;


use common\models\Movie;
use yii\httpclient\Client;
use http\Client\Request;
use Yii;
use yii\base\Module;
use yii\console\Controller;
use yii\helpers\Console;

/**
 * Class OssController
 * @package console\controllers
 */
class OssController extends Controller
{


    public function actionTest(){


      $accessKeyId = "YnA2I0pgJ80wiVwF";
        $accessKeySecret = "opqPvATTCIlklUI0F1VknOF8Vjzgnw";
        $endpoint = "oss-cn-qingdao.aliyuncs.com";
        try {
            $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint);
            $object = "example.jpg";

            $ossClient->uploadFile('zuxianzhi', $object, __DIR__."/example.jpg");
            print_r($ossClient);die;
        } catch (OssException $e) {
            print $e->getMessage();
        }

    }

}